MaxVal = 100000

n = int(input())
a = [0] * n;
for i in range(n):
    a[i] = int(input())
ans = 0

# c[d] - number of elemens = d
c = [0] * (MaxVal + 1)

# f[d] - number of pairs with first element = d
f = [0] * (MaxVal + 1)

for i in range(n - 1, -1, -1):
    f_a_i = f[a[i]]
    d = 1
    while d * d <= a[i]:
        if a[i] % d == 0:
            ans += f[d]
            f_a_i += c[d]
            div = a[i] // d
            if div != d:
                ans += f[div]
                f_a_i += c[div]
        d += 1
    f[a[i]] = f_a_i
    c[a[i]] += 1

print(ans)
